home *** CD-ROM | disk | FTP | other *** search
- on scrollArea clickV, scrollSprite, scrollField
- if scrollField = "browser" then
- clearDatabase()
- end if
- updateScrollArea(clickV, scrollSprite)
- updateBrowser(scrollSprite)
- updateStage()
- repeat while the mouseDown
- scrollArea(the mouseV, scrollSprite, scrollField)
- end repeat
- end
-
- on updateScrollArea clickV, scrollSprite
- set the locV of sprite scrollSprite to clickV
- end
-
- on updateBrowser scrollSprite
- global BrowserScrollBar, browserTopics, numVisibleTopics, browserTopLine
- set scrollHeight to the height of sprite BrowserScrollBar
- set V to the locV of sprite scrollSprite - the top of sprite BrowserScrollBar
- set browserTopLine to V * the number of lines in browserTopics / scrollHeight
- setFieldText("browser", browserTopLine, numVisibleTopics, browserTopics)
- end
-
- on scrollText clickedSprite, direction
- global textTopLine, numTextLines, textScroll, numVisibleTextLines, topicText
- scroll(clickedSprite, direction, textTopLine, "Displayed Text", numTextLines, textScroll, numVisibleTextLines, topicText)
- end
-
- on scrollBrowser clickedSprite, direction
- global browserTopLine, browserScroll, numVisibleTopics, browserTopics
- set numLines to the number of lines in browserTopics
- clearDatabase()
- scroll(clickedSprite, direction, browserTopLine, "browser", numLines, browserScroll, numVisibleTopics, browserTopics)
- end
-
- on scroll clickedSprite, direction, topline, scrollField, numLines, scrollSprite, numVisibleLines, allText
- set topline to updateTopLine(direction, topline, numLines, scrollField)
- moveScrollSquareToMatchText(topline, scrollSprite)
- setFieldText(scrollField, topline, numVisibleLines, allText)
- set spritecast to the castNum of sprite clickedSprite
- repeat while the mouseDown
- if the mouseCast = spritecast then
- scroll(clickedSprite, direction, topline, scrollField, numLines, scrollSprite, numVisibleLines, allText)
- end if
- end repeat
- end
-
- on updateTopLine amount, topline, max, scrollField
- set newTopLine to validNum(topline + amount, 1, max)
- updateGlobalTopLine(scrollField, newTopLine)
- return newTopLine
- end
-
- on updateGlobalTopLine scrollField, newTopLine
- global browserTopLine, textTopLine
- if scrollField = "browser" then
- set browserTopLine to newTopLine
- else
- set textTopLine to newTopLine
- end if
- end
-
- on moveScrollSquareToMatchText topline, scrollSprite
- global BrowserScrollBar, browserTopics, browserTopLine
- set scrollHeight to the height of sprite BrowserScrollBar
- set V to (topline * scrollHeight / the number of lines in browserTopics) + the top of sprite BrowserScrollBar
- set the locV of sprite scrollSprite to V
- updateStage()
- end
-
- on getScrollV topline
- global scrollTopValues
- return value(item 1 of line topline of scrollTopValues)
- end
-
- on setFieldText scrollField, topline, numVisibleLines, allText
- set the text of cast scrollField to line topline to numVisibleLines + topline - 1 of allText
- put EMPTY into line numVisibleLines + 1 of field scrollField
- end
-
- on displayKeyLineAtTop
- global numberTopics, browserTopics, browserTopLine, numVisibleTopics, browserScroll
- clearDatabase()
- if charToNum(the key) = 30 then
- scroll(0, -1, browserTopLine, "browser", numberTopics, browserScroll, numVisibleTopics, browserTopics)
- else
- if charToNum(the key) = 31 then
- scroll(0, 1, browserTopLine, "browser", numberTopics, browserScroll, numVisibleTopics, browserTopics)
- else
- repeat with i = 1 to numberTopics
- if convertToLower(the key) <= convertToLower(char 1 of line i of browserTopics) then
- set browserTopLine to i
- setFieldText("browser", browserTopLine, numVisibleTopics, browserTopics)
- moveScrollSquareToMatchText(browserTopLine, browserScroll)
- exit repeat
- end if
- end repeat
- end if
- end if
- end
-